home *** CD-ROM | disk | FTP | other *** search
/ Cre@te Online 2000 December / Cre@teOnline CD05.iso / MacSoft / XML ConsoleMax.sea / XML ConsoleMax / Required / swingall.jar / javax / swing / JEditorPane$JEditorPaneAccessibleHypertextSupport$HTMLLink.class (.txt) < prev    next >
Encoding:
Java Class File  |  1999-07-15  |  3.0 KB  |  94 lines

  1. package javax.swing;
  2.  
  3. import java.net.MalformedURLException;
  4. import java.net.URL;
  5. import javax.accessibility.AccessibleHyperlink;
  6. import javax.swing.JEditorPane.JEditorPaneAccessibleHypertextSupport;
  7. import javax.swing.event.HyperlinkEvent;
  8. import javax.swing.event.HyperlinkEvent.EventType;
  9. import javax.swing.text.AttributeSet;
  10. import javax.swing.text.BadLocationException;
  11. import javax.swing.text.Document;
  12. import javax.swing.text.Element;
  13. import javax.swing.text.html.HTML.Attribute;
  14. import javax.swing.text.html.HTML.Tag;
  15.  
  16. public class JEditorPane$JEditorPaneAccessibleHypertextSupport$HTMLLink extends AccessibleHyperlink {
  17.    // $FF: synthetic field
  18.    private final JEditorPane.JEditorPaneAccessibleHypertextSupport this$1;
  19.    Element element;
  20.  
  21.    public JEditorPane$JEditorPaneAccessibleHypertextSupport$HTMLLink(JEditorPane.JEditorPaneAccessibleHypertextSupport var1, Element var2) {
  22.       this.this$1 = var1;
  23.       this.element = var2;
  24.    }
  25.  
  26.    public boolean doAccessibleAction(int var1) {
  27.       if (var1 == 0 && this.isValid()) {
  28.          URL var2 = (URL)this.getAccessibleActionObject(var1);
  29.          if (var2 != null) {
  30.             HyperlinkEvent var3 = new HyperlinkEvent(JEditorPaneAccessibleHypertextSupport.access$0(this.this$1), EventType.ACTIVATED, var2);
  31.             JEditorPaneAccessibleHypertextSupport.access$0(this.this$1).fireHyperlinkUpdate(var3);
  32.             return true;
  33.          }
  34.       }
  35.  
  36.       return false;
  37.    }
  38.  
  39.    public Object getAccessibleActionAnchor(int var1) {
  40.       return this.getAccessibleActionDescription(var1);
  41.    }
  42.  
  43.    public int getAccessibleActionCount() {
  44.       return 1;
  45.    }
  46.  
  47.    public String getAccessibleActionDescription(int var1) {
  48.       if (var1 == 0 && this.isValid()) {
  49.          Document var2 = JEditorPaneAccessibleHypertextSupport.access$0(this.this$1).getDocument();
  50.          if (var2 != null) {
  51.             try {
  52.                return var2.getText(this.getStartIndex(), this.getEndIndex() - this.getStartIndex());
  53.             } catch (BadLocationException var3) {
  54.                return null;
  55.             }
  56.          }
  57.       }
  58.  
  59.       return null;
  60.    }
  61.  
  62.    public Object getAccessibleActionObject(int var1) {
  63.       if (var1 == 0 && this.isValid()) {
  64.          AttributeSet var2 = this.element.getAttributes();
  65.          AttributeSet var3 = (AttributeSet)var2.getAttribute(Tag.A);
  66.          String var4 = var3 != null ? (String)var3.getAttribute(Attribute.HREF) : null;
  67.          if (var4 != null) {
  68.             URL var5;
  69.             try {
  70.                var5 = new URL(JEditorPaneAccessibleHypertextSupport.access$0(this.this$1).getPage(), var4);
  71.             } catch (MalformedURLException var6) {
  72.                var5 = null;
  73.             }
  74.  
  75.             return var5;
  76.          }
  77.       }
  78.  
  79.       return null;
  80.    }
  81.  
  82.    public int getEndIndex() {
  83.       return this.element.getEndOffset();
  84.    }
  85.  
  86.    public int getStartIndex() {
  87.       return this.element.getStartOffset();
  88.    }
  89.  
  90.    public boolean isValid() {
  91.       return this.this$1.linksValid;
  92.    }
  93. }
  94.